﻿CREATE PROCEDURE [_Old_TEMP_PARSE]
@EntityType varchar(Max)

	
AS
BEGIN
DECLARE @first int, @second int, @len int, @output varchar(255), @String varchar(MAX)
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	SELECT @String=[Format] FROM DefinedCombinedAttributes WHERE EntityType = @EntityType

	SET @len = LEN(@string)
	SET @output = ''

	WHILE (@len > 0)
	BEGIN

	SET @first = CHARINDEX('#',@string)
	IF @first > 0
		BEGIN
			SET @output = @output + ' ; ' + SUBSTRING(@string,0,@first)
			SET @second = CHARINDEX('#',SUBSTRING(@string,@first+1,1000))
			SET @output = @output + ' ; ' + SUBSTRING(@String, @first+1, @second-1)
			SET @string = SUBSTRING(@string,@first+1+@second,@len)
			SET @len = LEN(@string)
		END
	ELSE
		BEGIN
		    SET @output = @output + ' ; ' + @string
			SET @len = 0
		END
	END
	
	SELECT @output
END
